import base64

IMAGE_PATH = "D:\\yolo\\yolov5-master\\yolov5-master\\data\\images\\22.jpg"  # 图像文件路径

# 读取图像并转换为Base64
with open(IMAGE_PATH, "rb") as image_file:
    image_data = image_file.read()
    base64_image = base64.b64encode(image_data).decode("utf-8")

# 输出Base64编码数据
print(base64_image)
